#include <bits/stdc++.h>
using namespace std;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
using ll = long long;
void solve()
{
    ll n, w;
    cin >> n >> w;
    vector<ll> a(n + 1);
    ll ans1 = 0, ans2 = 0;
    for (ll i = 1; i <= n; i++)
    {
        ll x;
        cin >> x;
        if (x >= 35)
        {
            if (w == 4)
            {
                ans2++;
            }
            else
            {
                ans1++;
            }
        }
        w++;
        if (w > 7)
            w = 1;
    }
    cout << ans1 << " " << ans2;
}
int main()
{
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
